package top.lixunda.ecommerce.server.user.api.entity.db;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 权限表，权限的最小原子单位
 * </p>
 *
 * @author Lixunda
 * @since 2020-04-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("permission")
@ApiModel(value="PermissionDO对象", description="权限表，权限的最小原子单位")
public class PermissionDO extends Model<PermissionDO> {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "权限ID，唯一主键")
    @TableId(value = "permission_id", type = IdType.AUTO)
    private Integer permissionId;

    @ApiModelProperty(value = "权限编号，真正的权限判定标志，不能重复")
    @TableField("permission_code")
    private String permissionCode;

    @ApiModelProperty(value = "权限名称，只是用来查看")
    @TableField("permission_name")
    private String permissionName;

    @ApiModelProperty(value = "权限描述")
    @TableField("permission_desc")
    private String permissionDesc;

    @ApiModelProperty(value = "创建模式，自动创建和手动创建")
    @TableField("create_mode")
    private String createMode;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "创建人员编号")
    @TableField("create_user_id")
    private Integer createUserId;

    @ApiModelProperty(value = "创建人员名称")
    @TableField("create_user_name")
    private String createUserName;

    @ApiModelProperty(value = "创建人员类型")
    @TableField("create_user_type")
    private String createUserType;

    @ApiModelProperty(value = "删除人员编号")
    @TableField("remove_user_id")
    private Integer removeUserId;

    @ApiModelProperty(value = "删除人员名称")
    @TableField("remove_user_name")
    private String removeUserName;

    @ApiModelProperty(value = "删除人员类型")
    @TableField("remove_user_type")
    private String removeUserType;

    @ApiModelProperty(value = "删除时间")
    @TableField("remove_time")
    private LocalDateTime removeTime;

    @ApiModelProperty(value = "逻辑删除字段")
    @TableField("usable")
    @TableLogic
    @JsonIgnore
    private Integer usable;


    @Override
    protected Serializable pkVal() {
        return this.permissionId;
    }

}
